/**
 * @Author: douxuefeng
 * @Date: 2020/9/7 下午1:40
 * @File: struct_map
 * @Desc:
 */
package go_common

import "encoding/json"

func Struct2Map(obj interface{}) (m map[string]interface{}, err error) {
	j, err := json.Marshal(obj)
	if err != nil {
		return nil, err
	}
	err = json.Unmarshal(j, &m)
	return
}